{% extends "base.html" %}

{% load wagtailcore_tags wagtailimages_tags %}

{% block body_class %}template-blogpage{% endblock %}

{% block content %}
    <h1>{{ page.title }}</h1>
    <p class="meta">介绍：{{ page.date }}</p>

    {% with authors=page.authors.all %}
        {% if authors %}
            <h3>作者:</h3>
            <ul>
                {% for author in authors %}
                    <li style="display: inline">
                        {% image author.author_image fill-40x60 style="vertical-align: middle" %}
                        {{ author.name }}
                    </li>
                {% endfor %}
            </ul>
        {% endif %}
    {% endwith %}

    <div class="intro">{{ page.intro }}</div>

    {{ page.body|richtext }}

    {% for item in page.gallery_images.all %}
        <div style="display: inline-flex; justify-content: start; margin: 10px;">
            <div>
                {% image item.image fill-320x240 %}
                <p>{{ item.caption }}</p>
            </div>
        </div>
    {% endfor %}

    {% with tags=page.tags.all %}
        {% if tags %}
            <div class="tags">
                <h3>Tags</h3>
                {% for tag in tags %}
                    <a href="{% slugurl 'tags' %}?tag={{ tag }}">
                        <button type="button">{{ tag }}</button>
                    </a>
                {% endfor %}
            </div>
        {% endif %}
    {% endwith %}

    <div>
        <a href="{{ page.get_parent.url }}">返回博客</a>
    </div>

{% endblock %}
